<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
           <meta name="author" content="Zhang Cheng">
		<title></title>
		
		<script src="js/vue.js" ></script>
		<script src="js/vue-router-3.0.1.js" type="text/javascript" charset="utf-8"></script>
		<style>
			.v-enter,.v-leave-to{
				opacity: 0;
				transform: translateY(200px);
			}
			.v-enter-active,.v-leave-active{
				transition: all 0.8s ease;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<router-link to="/account">account</router-link>			
				
				<transition mode="out-in">
					<router-view></router-view>
				</transition>
		</div>
		<template id="temp">
			<div >
				<h1>这是Account 组件</h1>			    
			    <router-link to="/account/login">登录</router-link>
				<router-link to="/account/register">注册</router-link>
				<transition mode='out-in'>
					<router-view></router-view>
				</transition>
			</div>
		</template>
		<script>
			var login = {            	
            	template:'<h1>登录组件</h1>',
            }
            
            var register = {
		      template: '<h1>注册组件</h1>'
		    }
			
			
			var account = {
				template:"#temp"
			}
			var router = new VueRouter({
				routes:[
					//{path:"/",redirect:"/account"},					
					{
						path:'/account',
						component:account,
						children:[//子路由的嵌套,子路由前面最好不要带斜线，不然永远会以根路径的形式去匹配url不方便理解
							{path:'login',component:login},
							{path:'register',component:register}
						]
					},
					
				]
				
			})
			
			var app = new Vue({
				el:'#app',
				data:{

				},
				methods:{
					
				},
				router:router,
			});
		</script>
	</body>
</html>